var TuYou = {};
var Cookie = {
	getCookie : function(name){
		
		var start = document.cookie.indexOf(name + "=");
		if (start == -1) {
			
			return null;
		}
		start = start + name.length + 1;
		
		var end = document.cookie.indexOf(";", start);
		if (end == -1) {
			
			end = document.cookie.length;
		}
		return document.cookie.substring(start, end);
	},
	setCookie : function(name, value, domain, secure){
		
		//不要忘了在对应getCookie函数里面加上decodeURI方法
		var str = name + "=" + encodeURI(value);
		if (domain) {
			str += "; domain=" + domain;
		}
		if (secure) {
			str += "; secure";
		}
		document.cookie = str;
	},
	removeCookie : function(){
		
		var expires = new Date();
		expires.setTime(expires.getTime() - 1);//将expires设为一个过去的日期，浏览器会自动删除它
		document.cookie = name + "=; expires=" + expires.toGMTString();
	}
};
Cookie.prototype = TuYou;